package com.example.jaxws.service;

import com.example.business.ProductServiceImpl;
import com.example.business.Type;

import javax.ejb.Stateless;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import java.util.ArrayList;
import java.util.List;

/**
 * SOAP web service for product catalog.
 */
@WebService
public class ProductCatalog {

    private final ProductServiceImpl productServiceImpl;

    public ProductCatalog() {
        this.productServiceImpl = new ProductServiceImpl();
    }

    @WebMethod
    public List<String> getProductCategories() {
        return productServiceImpl.getProductCategories();
    }

    @WebMethod()
    public List<String> getProducts(
            @WebParam String category) {
        return productServiceImpl.getProducts(category);
    }

    @WebMethod(exclude = true)
    public boolean addProduct(
            @WebParam String category,
            @WebParam String product) {
        return productServiceImpl.addProduct(category, product);
    }

}